
	<?

	require("PHPMailer/class.phpmailer.php"); // 路徑請自訂

	$mail = new PHPMailer();


	$mail->IsSMTP(); // telling the class to use SMTP
	$mail->CharSet = 'utf-8';
	$mail->Encoding = 'base64';
	//$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
		                                   // 1 = errors and messages
		                                   // 2 = messages only
	$mail->SMTPAuth   = true;                  // enable SMTP authentication
	$mail->Host       = 'ssl://smtp.gmail.com'; // sets the SMTP server
	$mail->Port       = 465;                    // set the SMTP port for the GMAIL server

	$mail->Username   = 'maymaymay621@gmail.com'; // SMTP account username
	$mail->Password   = 'desk78aer';        // SMTP account password

	$admin_mail = 'maymaymay621@gmail.com';

	$mail->SetFrom($admin_mail, '小烏龜草仔粿');

	$mail->AddReplyTo($admin_mail,"小烏龜草仔粿");

	$mail->Subject    = $mail_Subject ;

	//$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test


	$body = $m_body ;
	$body  = eregi_replace("[\]",'',$body);

	$mail->MsgHTML($body);

	$address = $order_mail ;

	//@加入屬於密件副本的電子郵件地址。
	//@這裡的電子郵件地址都是從資料表`kart_manage`(購物車管理者帳戶)裡撈出來，
	//@這張表裡的帳戶是用來登入購物車查看訂單和設定商品用的，允許不設定電子郵件地址，
	//@所以有可能撈到NULL值，就表示不用加到密件副本裡面。
	$ary_bccEmails = $back_mail;
	foreach($ary_bccEmails as $eachBcc)
	{
		if(TRUE === is_null($eachBcc))
		{
			continue;
		}
		elseif(FALSE === is_null($eachBcc))
		{
			$mail->AddBCC($eachBcc);
		}
	}

	$mail->AddAddress($address, $order_name);
	$mail->AddAddress('maymaymay621@gmail.com', '小烏龜草仔粿');

	$mail->Send();
/*
	if(!$mail->Send())
	{
	  echo "Mailer Error: " . $mail->ErrorInfo;
	}
	else
	{
	  echo "Message sent!";
	}
*/
	?>
